use wasm_bindgen::prelude::*;

// 简单的 wasm 实例

#[wasm_bindgen]
pub fn wasm_add(a: i32, b: i32) -> i32 {
    a + b
}

#[wasm_bindgen]
pub fn calculate_sum() -> i32 {
    let mut sum = 0;
    for _ in 0..10_000_000 {
        sum += wasm_add(1, 1); // 调用 wasm_add 函数一千万次
    }
    sum
}
